﻿<UserControl x:Class="SolutionUsingThreadsInModel.View.ThousandsOfElementsInUIControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Converter="clr-namespace:SolutionUsingThreadsInModel.View.Converter" xmlns:View1="clr-namespace:SolutionUsingThreadsInModel.View" mc:Ignorable="d" d:DesignHeight="1000" d:DesignWidth="1000">
    <UserControl.Resources>
        <Converter:IdToMarginConverter x:Key="idToMarginConverter" />
    </UserControl.Resources>

    <Grid>
        <ItemsControl x:Name="SmallItems" ItemsSource="{Binding Path=SmallItems}" Margin="20">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <View1:SmallItemControl HorizontalAlignment="Left" VerticalAlignment="Top" Margin="{Binding Path=Id, Converter={StaticResource idToMarginConverter}}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        <Button Content="Load All Small Items" Command="{Binding Path=LoadAllSmallItemsCommand}" Height="37" HorizontalAlignment="Left" Margin="20,260,0,0" Name="button1" VerticalAlignment="Top" Width="140" />
        <Button Content="Show Message" Height="34" HorizontalAlignment="Left" Margin="199,260,0,0" Name="button2" VerticalAlignment="Top" Width="114" Click="button2_Click"/>
    </Grid>
</UserControl>
